import Vue from 'vue'
import VueRouter from 'vue-router'
import FoodIndex from "@/views/common/FoodIndex";
import ProductShowAll from "@/views/chanPinZongLan/ProductShowAll";
import IndexAll from "@/views/common/IndexAll";
import ProductManager from "@/views/producture/ProductManager";
import AgentList from "@/views/producture/AgentList";
import BecomeAgent from "@/views/common/BecomeAgent";
import Login from "@/views/common/Login";
import AuditOverview from "@/views/producture/AuditOverview";
import AgencyManager from "@/views/agency/AgencyManager";
import ContractManagement from "@/views/contract/ContractManagement";
import AddProduct from "@/views/producture/AddProduct";
import ProductList from "@/views/producture/ProductList";
import RotationChart from "@/views/producture/RotationChart";
import BuyProductList from "@/views/agency/BuyProductList";
import OrderRecord from "@/views/agency/OrderRecord";
import OrderConfirm from "@/views/agency/OrderConfirm";
import OrderListRecord from "@/views/producture/OrderListRecord";
import AgencyBossManager from "@/views/agencyBoss/AgencyBossManager";
import OrderListRecordAgency from "@/views/agencyBoss/OrderListRecordAgency";
import ReviewProgress from "@/views/agency/ReviewProgress";
import AccountStatus from "@/views/agency/AccountStatus";
import AgencyBossReviewProgress from "@/views/agencyBoss/AgencyBossReviewProgress";
import AppealApproval from "@/views/agencyBoss/AppealApproval";
import SettingIndexPicture from "@/views/producture/SettingIndexPicture";
import ProductureMessage from "@/views/producture/ProductureMessage";
import AgencyBossMessage from "@/views/agencyBoss/AgencyBossMessage";
import AgencyMessage from "@/views/agency/AgencyMessage";

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'indexAll',
    component: IndexAll,
    redirect:'/foodIndex',
    children:[
      {
        path: '/foodIndex',
        name: 'foodIndex',
        component: FoodIndex
      },
      {
        path: '/productShowAll',
        name: 'productShowAll',
        component: ProductShowAll
      },
      {
        path: '/becomeAgent',
        name: 'becomeAgent',
        component: BecomeAgent
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: Login
  },
  {
    path: '/productManager',
    name: 'productManager',
    component: ProductManager,
    redirect: '/contractManagement',
    children: [
      {
        path: '/agentList',
        name: 'agentList',
        component: AgentList
      },
      {
        path: '/auditOverview',
        name: 'auditOverview',
        component: AuditOverview
      },
      {
        path: '/contractManagement',
        name: 'contractManagement',
        component: ContractManagement
      },
      {
        path: '/addProduct',
        name: 'addProduct',
        component: AddProduct
      },
      {
        path: '/productList',
        name: 'productList',
        component: ProductList
      },
      {
        path: '/rotationChart',
        name: 'rotationChart',
        component: RotationChart
      },
      {
        path: '/orderListRecord',
        name: 'orderListRecord',
        component: OrderListRecord
      },
      {
        path: '/settingIndexPicture',
        name: 'settingIndexPicture',
        component: SettingIndexPicture
      },
      {
        path: '/productureMessage',
        name: 'productureMessage',
        component: ProductureMessage
      },
    ]
  },
  {
    path: '/agencyManager',
    name: 'agencyManager',
    component: AgencyManager,
    redirect: '/buyProductList',
    children: [
      {
        path: '/buyProductList',
        name: 'buyProductList',
        component: BuyProductList
      },
      {
        path: '/orderRecord',
        name: 'orderRecord',
        component: OrderRecord
      },
      {
        path: '/orderConfirm',
        name: 'orderConfirm',
        component: OrderConfirm
      },
      {
        path: '/reviewProgress',
        name: 'reviewProgress',
        component: ReviewProgress
      },
      {
        path: '/accountStatus',
        name: 'accountStatus',
        component: AccountStatus
      },
      {
        path: '/agencyMessage',
        name: 'agencyMessage',
        component: AgencyMessage
      },
    ]
  },
  {
    path: '/agencyBossManager',
    name: 'agencyBossManager',
    component: AgencyBossManager,
    redirect: '/orderListRecordAgency',
    children: [
      {
        path: '/orderListRecordAgency',
        name: 'orderListRecordAgency',
        component: OrderListRecordAgency
      },
      {
        path: '/agencyBossReviewProgress',
        name: 'agencyBossReviewProgress',
        component: AgencyBossReviewProgress
      },
      {
        path: '/appealApproval',
        name: 'appealApproval',
        component: AppealApproval
      },
      {
        path: '/agencyBossMessage',
        name: 'agencyBossMessage',
        component: AgencyBossMessage
      }
    ]
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
